/*	var zNodes = [
 {id: 1, pId: 0, name: "分组 1", open: true},
 {id: 11, pId: 1, name: "分组 1-1", open: true},
 {id: 111, pId: 11, name: "分组 1-1-1"},
 {id: 112, pId: 11, name: "分组 1-1-2"},
 {id: 12, pId: 1, name: "分组 1-2", open: true},
 {id: 121, pId: 12, name: "分组 1-2-1"},
 {id: 122, pId: 12, name: "分组 1-2-2"},
 ];*/


//ztree初始化设置
var settingSearch = {
	view: {
		dblClickExpand: false
	},
	data: {
		simpleData: {
			enable: true,
		}
	},
	callback: {
		onClick: onClickSearch,
		//onCheck: onCheck
	}
};
//数据

function onClickSearch(e, treeId, treeNode) {

	if (treeNode) {
		var name = treeNode.name;
		$("#departmentSearch").val(name);
		$("#depIdSearch").val(treeNode.id);
		hideMenu();
	}

}

function showMenuSearch() {
	$("#depTreeSearch-win").dialog('open');
	$.post(path + "/dep/depTree", function (data) {
		//console.info(data);
		$.fn.zTree.init($("#zTreeSearch"), settingSearch, data);
		var treeObj = $.fn.zTree.getZTreeObj("zTreeSearch");
		var nodes = treeObj.getNodes();
		if (nodes.length > 0) {
			for (var i = 0; i < nodes.length; i++) {
				treeObj.expandNode(nodes[i], true, false, false);
			}
		}
	});
}
function hideMenu() {
	$("#depTreeSearch-win").dialog('close');
}